<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
    <head>
        <!-- Required meta tags -->
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <meta name="keywords" th:content="${config.getWebkeywords()}" />
        <meta name="description" th:content="${config.getWebms()}" />
        <meta name="author" content="Hellohao" />
        <title th:text="${config.getWebname()}"></title>
        <link rel="shortcut icon" th:href="${config.getWebfavicons()}" type="image/x-icon"/>
        <link rel="icon" type="image/ico" th:href="${config.getWebfavicons()}" />
        <link rel="stylesheet" th:href="@{/css/intro.css}" />
        <link th:href="@{/webuploade/css/webuploader.css}" media="all" rel="stylesheet" type="text/css"/>
        <link th:href="@{/webuploade/css/style.css}" media="all" rel="stylesheet" type="text/css"/>
        <link th:href="@{/webuploade/css/component.css}" media="all" rel="stylesheet" type="text/css"/>
        <link th:href="@{/static/css/login-register.css}" media="all" rel="stylesheet" type="text/css"/>
        <link rel="stylesheet" th:href="@{/css/verify.css}" />
        <link rel="stylesheet" th:href="@{/css/Mini/reset.css}" />
        <link rel="stylesheet" th:href="@{/css/Mini/style.css}" />
        <link rel="stylesheet" th:href="@{/static/css/animate.min.css}" />
        <link rel="stylesheet" th:href="@{/layui/layui/css/layui.css}" />
        <link rel='stylesheet' th:href="@{css/urllist/all.min.css}" />
        <link rel="stylesheet" th:href="@{/css/urllist/style.css}" />
        <link rel="stylesheet" th:href="@{/css/default.css}" id="theme-color" />
        <style>
            #uploader .placeholder {
                /* border: 3px dashed #4ebd87; */
                min-height: 238px;
                padding-top: 158px;
                text-align: center;
                background: url(/webuploade/images/image2.png) center 93px no-repeat;
                color: #555555;
                font-size: 18px;
                position: relative;
            }
            #uploader .placeholder .webuploader-pick {
                /*background: #57a3f3;*/
                background: linear-gradient(to right,#2775ff,#7202bb);
                color: #FFFFFF;
            }
            #container {border: 0px solid #FFF;border-radius: 0px;font-size: 12px;margin-top: 10px;}
            .nav-item:hover{position: relative;}
            #asd:hover{position: relative;}
            .layui-tab-brief > .layui-tab-title .layui-this {color: #ff0000;}
            .feather-grid{color: #F5F5F6;}
            #uploader .statusBar .btns .uploadBtn {background: linear-gradient(to right,#2775ff,#7202bb);}
            #uploader .statusBar .btns .uploadBtn:hover {background: linear-gradient(to right,#2775ff,#7202bb);}
            .fontstyle{word-wrap: break-word;word-break: break-all;overflow: hidden;margin-left: 10px;}
            .el-backtop {
                position: fixed;
                background-color: #fff;
                width: 40px;
                height: 40px;
                border-radius: 50%;
                color: #409eff;
                display: flex;
                align-items: center;
                justify-content: center;
                font-size: 20px;
                /*box-shadow: 0 0 6px rgba(0,0,0,.12);*/
                cursor: pointer;
                z-index: 5;
                border: 1px solid #f0f0f0;
                box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.35);
            }
            .el-backtop:hover{

            }
            .close {
                font-size: 1.5rem;
            }
            #jyupdate{
                color: #2a70fc;font-size: 0.9em;cursor:pointer;font-weight: bold;
            }
            #setday{
                font-weight: bold;
                cursor: pointer;
            }
            .mt-5, .my-5 {
                margin-top: 0rem !important;
            }
            .pb-5, .py-5 {
                padding-bottom: 1rem !important;
            }
            .pt-5, .py-5 {
                padding-top: 1rem !important;
            }
        </style>
    </head>
    <body>
        <section class="sticky-top sticky-navigation" style=" background: linear-gradient(to right,#2775ff,#7202bb); ">
            <div class="container">
                <nav class="navbar navbar-expand-md navbar-light" style="color: #F5F5F6;">
                    <a class="navbar-brand heading-black animated fipInX " href="/" style="color: #F5F5F6;">
                        Hellohao图床
                    </a>
                    <button class="navbar-toggler navbar-toggler-right border-0" type="button" data-toggle="collapse" 
                            data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
                        <span data-feather="grid"></span>
                    </button>
                    <div class="collapse navbar-collapse animated fipInX " id="navbarCollapse">
                        <ul class="navbar-nav ml-auto" id="usersrc" >
                            <li class="nav-item" >
                                <a style="color: #F5F5F6;" href="javascript:;" class="nav-link page-scroll d-flex flex-row align-items-center md-trigger" onclick="tologin()" >
                                    <em data-feather="user" width="18" height="18" class="mr-2"></em>
                                    登录
                                </a>
                            </li>
                            <li class="nav-item" id="asd">
                                <a style="color: #F5F5F6;" href="javascript:;" class="nav-link page-scroll d-flex flex-row align-items-center md-trigger" onclick="toregister()">
                                    <em data-feather="user-plus" width="18" height="18" class="mr-2"></em>
                                    注册
                                </a>
                            </li>
                        </ul>
                    </div>
                </nav>
            </div>
        </section>

        <section class="bg-hero py-7">
            <div class="container">

                <div class="alert alert-info" role="alert" id="explaindiv" style="display: none;">
                    <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <strong>🔊</strong> <span id="explain">Better check yourself, you're not looking too good.</span>
                </div>
                    <form enctype="multipart/form-data">
                        <!--图片上传模板-->
                        <div id="wrapper">
                            <div id="container" class="animated bounce" style="border-radius: 5px;border: 1px solid #ebeef5;box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);">
                                <!--头部，相册选择和格式选择-->
                                <div id="uploader">
                                    <div class="queueList">
                                        <div id="dndArea" class="placeholder">
                                            <br />
                                            <span class="text">您也可以尝试文件拖拽，使用截屏工具，然后激活窗口后使用Ctrl+V粘贴。<span id="whts" data-toggle="popover" title="Example popover" class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></span>
                                            <br />
                                            <span class="text" id="urlsc" ><a style="color: #2a70fc;font-size: 0.9em;cursor:pointer;font-weight: bold;" onclick="imgsc()">使用图片URL地址上传</a></span>
                                            <div id="filePicker">

                                            </div>
                                        </div>
                                    </div>
                                    <div class="statusBar" style="display:none;">
                                        <div class="progress">
                                            <span class="text">0%</span>
                                            <span class="percentage"></span>
                                        </div><div class="info"></div>
                                        <div class="btns">
                                            <div id="filePicker2"></div><div class="uploadBtn">开始上传</div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </form>
            </div>
        </section>

        <section class="bg-hero py-7" id="updateurl" style="display: none;">
            <div class="text-center mb-60 position-relative">
                <h5 class="font__family-montserrat font__weight-light text-uppercase font__size-18 text-blue brk-library-rendered" data-brk-library="component__title">Picture link address</h5>
                <hr class="divider wow zoomIn brk-library-rendered" data-brk-library="component__title" style="visibility: visible; animation-name: zoomIn;">
            </div>
            <div class="container">
                <div class="panel__wrapper-icon mb-100 brk-library-rendered" data-brk-library="component__panel">
                    <div class="panel__head all-light">
                        <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief" style="margin: 0 auto;">
                            <ul class="layui-tab-title">
                                <li class="imgurltype" onclick="imgurltype(2)" style="float:right;display: inline-block;">Markdown</li>
                                <li class="imgurltype" onclick="imgurltype(3)" style="float:right;display: inline-block;">HTML</li>
                                <li class="imgurltype" onclick="imgurltype(4)" style="float:right;display: inline-block;">BBCode</li>
                                <li class="layui-this imgurltype" onclick="imgurltype(1)" style="float:right;display: inline-block;">U R L</li>
                            </ul>
                        </div>
                    </div>
                    <ul class="panel__list" id="imgurls">
                    </ul>
                    <div class="el-backtop" style="right: 50px; bottom: 150px;" onclick="anniu()"><i class="layui-icon layui-icon-picture" style="color: #666666;"></i>  </div>
                </div>
            </div>
        </section>
        <br /><br />
        <footer class="py-5 bg-light" style="position: fixed;bottom: 0px;width: 100%;">
            <div class="container">
                    <div class="row mt-5">
                    <div class="col-12 text-muted text-center small-xl" th:utext="${config.getLinks()}" >
                        &copy; 2019 Hellohao - All Rights Reserved - Collect from <a href="http://www.Hellohao.cn/" target="_blank" title="Hellohao">Hellohao博客</a>
                    </div>
                </div>
            </div>
        </footer>
        <div class="scroll-top">
            <i class="fa fa-angle-up" aria-hidden="true"></i>
        </div>
        <input type="hidden" th:value="${suffix}" id="suffix" />
        <input type="hidden" th:value="${config.getExplain()}" id="exp" />
            <div class="login" style="z-index: 9999;display: none;position: fixed;">
            </div>
            <div class="sk-rotating-plane"></div>
            <div class="modal-backdrop fade show" id="zhezhao" style="display: none;"></div>
        <script th:src="@{/static/js/jquery-3.4.1.min.js}" type="text/javascript"></script>
<!--        <script type="text/javascript" th:src="@{/static/js/bootstrap.min.js}"></script>-->
        <script th:src="@{/js/bootstrap.jj.js}"></script>
        <script th:src="@{/static/js/bootbox.min.js}"></script>
        <script th:src="@{/static/js/clipboard.min.js}"></script>
        <script th:src="@{/layui/layui/layui.js}"></script>
        <script th:src="@{/webuploade/js/webuploader.js}"></script>
        <script th:src="@{/static/js/login-register.js}"></script>
        <script th:src="@{/webuploade/js/upload.js}" ></script>
        <script th:src="@{/webuploade/js/classie.js}"></script>
        <script th:src="@{/static/js/sweetalert2.min.js}"></script>
        <script th:src="@{/layui/layui/layui.js}"></script>
        <script type="text/javascript" th:src="@{/js/feather.min.js}"></script>
        <script th:src="@{/js/verify.js}"></script>
        <script th:src="@{/js/js.cookie.min.js}"></script>
        <script th:src="@{/js/base64.min.js}"></script>
        <script th:src="@{/static/js/clipboard.min.js}"></script>
        <script th:src="@{/js/jquery.qrcode.min.js}"></script>

    <script>

        $("#myModal modal-backdrop").addClass('show')
        var isday = 0;
        var verification = false;
        var zcverification = false;
        var logotmp = 0;
        var zctmp = 0;
        var arr_imgurl = "";
        var arr_url = "";
        var arr_markdown = "";
        var arr_html = "";
        var arr_ddcode = "";
        var urltypes = 1;//1 url 2 md 3 a标签 4 论坛格式
        var VisitorUpload = [[${VisitorUpload}]];
        var filesize = [[${filesize}]];
        var imgcount = [[${imgcount}]];
        var theme = [[${config.getTheme()}]];
        var exp = $("#exp").val();
        var suffix= $('#suffix').val();
        var qq ='hellohao-code-yz';
        var layer;
        layui.use('layer', function(){
            layer = layui.layer;
            //url(../images/img2.png) center 93px no-repeat
            feather.replace();
        });
        $(function () {
            $.ajax({
                type: "POST",
                url: "/islogin",
                dataType: "json",
                success: function (data) {
                    if(data.lgoinret==1){
                        bodys();
                    }
                }
            });
        if(exp!="" && exp!=null && typeof(exp) != undefined){
            $("#explaindiv").show();
            $("#explain").text(exp);
        }else{
            $("#explaindiv").hide();
        }

        });

        function tologin() {

            var html = ' <p style="display: block;float: right;margin-top: 5px; cursor:pointer;margin-right: 13px;font-size: 24px;" onclick="Closelogin()">×</p>\n' +
                '                <div class="login-top">\n' +
                '                    登录\n' +
                '                </div>\n' +
                '                <div class="login-center clearfix">\n' +
                //'                    <div class="login-center-img"><img th:src="@{/img/name.png}"/></div>\n' +
                '                    <div class="login-center-input">\n' +
                '                        <input type="text" id="loginemail" name="" value="" placeholder="请输入您的邮箱" onfocus="this.placeholder=\'\'" onblur="this.placeholder=\'请输入您的邮箱\'"/>\n' +
                '                        <div class="login-center-input-text">邮箱</div>\n' +
                '                    </div>\n' +
                '                </div>\n' +
                '                <div class="login-center clearfix">\n' +
                //'                    <div class="login-center-img"><img th:src="@{/img/password.png}"/></div>\n' +
                '                    <div class="login-center-input">\n' +
                '                        <input type="password" id="loginpassword" name=""value="" placeholder="请输入您的密码" onfocus="this.placeholder=\'\'" onblur="this.placeholder=\'请输入您的密码\'"/>\n' +
                '                        <div class="login-center-input-text">密码</div>\n' +
                '                    </div>\n' +
                '                </div>\n' +
                '                <div class="login-center clearfix">\n' +
                '                    <div style="width: 280px;height: 50px;">\n' +
                '                        <div id="mpanel1" ></div>\n' +
                '                    </div>\n' +
                '                </div>\n' +
                '                <div class="login-button" onclick="loginAjax()">\n' +
                '                    登陆\n' +
                '                </div>';


            $('.login').html(html);
            $('#zhezhao').show();
            $('.login').show();
            $('.login').addClass('animated  slideInDown');
            $('body').css({
                "overflow-x":"hidden",
                "overflow-y":"hidden"
            });
            initSlideVerify(1);
        }

        function toregister() {
            var html = '<p style="display: block;float: right;margin-top: 5px; cursor:pointer;margin-right: 13px;font-size: 24px;" onclick="Closelogin()">×</p>\n' +
                '            <div class="login-top" style="margin-top: 50px;">\n' +
                '                注册\n' +
                '            </div>\n' +
                '            <p align="center" style="color: #db5860;margin-top: -40px;" id="zcts"></p>\n' +
                '            <div class="login-center clearfix">\n' +
                //'                <div class="login-center-img"><img th:src="@{/img/name.png}"/></div>\n' +
                '                <div class="login-center-input">\n' +
                '                    <input type="text" id="registerusername" name="username" value="" placeholder="用户名(数字/字母不得超过10位)" onfocus="this.placeholder=\'\'" onblur="this.placeholder=\'用户名(数字/字母不得超过10位)\'"/>\n' +
                '                    <div class="login-center-input-text">用户名</div>\n' +
                '                </div>\n' +
                '            </div>\n' +
                '            <div class="login-center clearfix">\n' +
                //'                <div class="login-center-img"><img th:src="@{/img/name.png}"/></div>\n' +
                '                <div class="login-center-input">\n' +
                '                    <input type="text" id="registeremail" name="email" value="" placeholder="待验证的邮箱" onfocus="this.placeholder=\'\'" onblur="this.placeholder=\'待验证的邮箱\'"/>\n' +
                '                    <div class="login-center-input-text">邮箱</div>\n' +
                '                </div>\n' +
                '            </div>\n' +
                '            <div class="login-center clearfix">\n' +
                //'                <div class="login-center-img"><img th:src="@{/img/password.png}"/></div>\n' +
                '                <div class="login-center-input">\n' +
                '                    <input type="password" id="registerpassword" name="password" value="" placeholder="请输入您的密码" onfocus="this.placeholder=\'\'" onblur="this.placeholder=\'请输入您的密码\'"/>\n' +
                '                    <div class="login-center-input-text">密码</div>\n' +
                '                </div>\n' +
                '            </div>\n' +
                '            <div class="login-center clearfix">\n' +
                //'                <div class="login-center-img"><img th:src="@{/img/password.png}"/></div>\n' +
                '                <div class="login-center-input">\n' +
                '                    <input type="password" id="registerpassword_confirmation" name="password" value="" placeholder="请输入您的密码" onfocus="this.placeholder=\'\'" onblur="this.placeholder=\'请输入您的密码\'"/>\n' +
                '                    <div class="login-center-input-text">密码</div>\n' +
                '                </div>\n' +
                '            </div>\n' +
                '            <div class="login-center clearfix">\n' +
                '                <div style="width: 280px;height: 50px;">\n' +
                '                    <div id="mpanel2" ></div>\n' +
                '                </div>\n' +
                '            </div>\n' +
                '            <div class="login-button" onclick="ismail();">\n' +
                '                注册\n' +
                '            </div>';

            $('.login').html(html);
            $('#zhezhao').show();
            $('.login').show();
            $('.login').addClass('animated  slideInDown');
            $('body').css({
                "overflow-x":"hidden",
                "overflow-y":"hidden"
            });
            initSlideVerify(2);
        }

        function Closelogin() {
            $('#zhezhao').hide();
            $('.login').hide();
            $('.registers').hide();
            $('body').css({
                "overflow-x":"auto",
                "overflow-y":"auto"
            });
        }

        function imgsc() {
            var str = '输入图片URL地址：';
            if(isday>0){
                str = '输入图片URL地址：('+isday+'天后将会自动销毁)';
            }
            swal(str, {
                content: "input",
            })
                .then((value) => {
                    var result =value;
                    if(result!=null && result!="" ){
                        urlimg(result);
                    }
                });
        }
        function urlimg(result) {
            if(result) {
                var rx=/^https?:\/\//i;
                if(rx.test(result)==true){
                    var msgid = layer.msg('上传中..', {
                        icon: 16
                        ,shade: 0.01
                    });
                    qq = GetDateStr(new Date());
                    $('#loadingModal').modal({backdrop: 'static', keyboard: false,upurlk:qq});
                    $.ajax({
                        type: "POST",
                        url: "/upurlimg",
                        dataType: "json",
                        data: {imgurl: result,setday:isday,upurlk:qq},
                        success: function (data) {
                            layer.close(msgid);
                            for(var i=0;i<data.length;i++){
                                if(data[i]==-1){
                                    $('#loadingModal').modal('hide');
                                    swal('上传失败', '未配置存储源，请先后台配置存储源');
                                }
                                else if(data[i]==-2){
                                    $('#loadingModal').modal('hide');
                                    swal('上传失败', '图片太大或不存在');
                                }
                                else if(data[i]==-3){
                                    $('#loadingModal').modal('hide');
                                    swal('上传失败', '文件类型不符合要求');
                                }
                                else if(data[i]==-4){
                                    $('#loadingModal').modal('hide');
                                    swal('上传失败', '该文件不支持上传');
                                }else if(data[i]==-5){
                                    $('#loadingModal').modal('hide');
                                    swal('上传失败，可用空间不足');
                                }else if(data[i]==403){
                                    $('#loadingModal').modal('hide');
                                    swal('非法调用，请刷新页面后重试');
                                }else if(data[i]==911){
                                    $('#loadingModal').modal('hide');
                                    swal('你目前不能上传图片,请联系管理员');
                                }else{
                                    $('#loadingModal').modal('hide');
                                    swal('上传成功', '该图片链接已成功上传');
                                    $("#address").css('display', 'block');
                                    $("#updateurl").show();
                                    arr_url += data[i] + '\r\n';
                                    arr_imgurl += '<li onclick="copyimgurl(this)" class="copyimgurl"><span class="line"></span><i class="icon fab fa-gg"></i><p class="fontstyle" >'+data[i]+ '</p></li>';
                                    arr_markdown += '<li onclick="copyimgurl(this)" class="copyimgurl "><span class="line"></span><i class="icon fab fa-gg"></i><p class="fontstyle">'+'![image](data[i])</p></li>';
                                    arr_html += '<li onclick="copyimgurl(this)" class="copyimgurl "><span class="line"></span><i class="icon fab fa-gg"></i><p class="fontstyle">'+'&lt;img src="' + data[i] + '" alt="image" /&gt; </p></li>';
                                    arr_ddcode +='<li onclick="copyimgurl(this)" class="copyimgurl"><span class="line"></span><i class="icon fab fa-gg"></i><p class="fontstyle">'+'[img]'+data[i]+'[/img]</p></li>';
                                }
                                if(urltypes==1){
                                    $("#imgurls").html(arr_imgurl);
                                }else if(urltypes==2){
                                    $("#imgurls").html(arr_markdown);
                                }else if(urltypes==3){
                                    $("#imgurls").html(arr_html);
                                }else{
                                    $("#imgurls").html(arr_ddcode);
                                }
                            }
                        }
                    });
                }else{layer.close(msgid);Popups('网址格式错误','网址必须以http(s)://开头。','error');}
            }
        }

        function setday() {
            swal("输入图片期限（天）,到期自动销毁图片,最高365天：\n(输入0为永久保存)", {
                content: "input",
                html: true,
            })
                .then((value) => {
                    var result =value;
                    var reg=/^[0-9]\d*$/;
                    if(result!=null && result!="" ){
                        if(reg.test(result)){
                            if(result<=365){
                                isday = result;
                                // 初始化以后添加
                                uploader.options.formData.setday = isday;
                            }else{
                                swal('输入天数有误，最大不可超过365天');
                            }
                        }else{
                            swal('输入格式不正确，只可输入0-9之间正整数');
                        }
                    }
                    if(isday>0){
                        $('#setday').text(isday+'天后销毁');
                    }else{
                        $('#setday').text('图片期限');
                    }
                });
        }
        function keyLogin(){
            if (event.keyCode==13)
                document.getElementById("dl").click();
        }

        function loginAjax() {
            var loginemail = $("#loginemail").val();
            var loginpassword = $("#loginpassword").val();
            if(verification){
                //验证成功
                $.ajax({
                    type: "POST",
                    url: "/user/login",
                    data: {email: loginemail, password: loginpassword,logotmp:logotmp},
                    dataType: "json",
                    success: function (data) {
                        $('#loginModal').modal('hide');
                        if (data == 1) {
                            layer.msg('登录成功', {icon: 1});
                            setTimeout(function () {
                                window.location.reload();
                            }, 1000);
                        } else {
                            if (data == -1) {
                                //$('#dlts').text('您的账号是未激活状态，无法登陆。');
                                layer.msg('此账号是未激活状态，无法登陆', {icon: 4});
                                again(1);
                            } else if(data==-2){
                                //$('#dlts').text('您的账号已被冻结。');
                                layer.msg('您的账号已被冻结', {icon: 2});
                                again(1);
                            }else if(data==-3){
                                //$('#dlts').text('非法登录，请刷新页面重新尝试。');
                                layer.msg('非法登录，请刷新页面重新尝试', {icon: 2});
                                again(1);
                            }
                            else {
                                //$('#dlts').text('登录失败，你的邮箱或密码不正确，请重试。');
                                layer.msg('登录失败，邮箱或者密码不正确', {icon: 2});
                                again(1);
                            }
                            setTimeout(function () {
                                //window.location.reload();
                            }, 2000);
                        }
                    }
                });
            }else{
                //$('#dlts').text('请滑动验证码进行验证，才可登录。');
                layer.msg('请滑动验证码进行验证，才可登录。', {icon: 2});
            }
        }

        function initSlideVerify(v) {
            if(v==1){
                $('#mpanel1').slideVerify({
                    type : 1,		//类型
                    vOffset : 5,	//误差量，根据需求自行调整
                    barSize : {
                        width : '100%',
                        height : '40px',
                    },
                    ready : function() {
                    },
                    success : function() {
                        verification = true;
                        var myDate = new Date();
                        var tmp = Number(myDate.getMinutes()+''+myDate.getSeconds());
                        logotmp = (tmp-500+1+2+3-4);
                        $.ajax({
                            type: "POST",
                            url: "/user/verification",
                            data:{tmp:logotmp,type:1},
                            dataType: "json",
                            success: function (data) {}
                        });
                    },
                    error : function() {}
                });
            }else{
                $('#mpanel2').slideVerify({
                    type : 1,		//类型
                    vOffset : 5,	//误差量，根据需求自行调整
                    barSize : {
                        width : '100%',
                        height : '40px',
                    },
                    ready : function() {
                    },
                    success : function() {
                        zcverification = true;
                        var myDate = new Date();
                        var tmp = Number(myDate.getMinutes()+''+myDate.getSeconds());
                        zctmp = (tmp-500+1+2+3-4);
                        $.ajax({
                            type: "POST",
                            url: "/user/verification",
                            data:{tmp:zctmp,type:2},
                            dataType: "json",
                            success: function (data) {}
                        });
                    },
                    error : function() {}
                });
            }
        }


        function again(v) {
            if(v==1){
                logotmp=0;
                verification = false;
                $('#mpanel1').html('');
                $('#mpanel1').slideVerify({
                    type : 1,		//类型
                    vOffset : 5,	//误差量，根据需求自行调整
                    barSize : {
                        width : '100%',
                        height : '40px',
                    },
                    ready : function() {
                    },
                    success : function() {
                        verification = true;
                        var myDate = new Date();
                        var tmp = Number(myDate.getMinutes()+''+myDate.getSeconds());
                        logotmp = (tmp-500+1+2+3-4);
                        $.ajax({
                            type: "POST",
                            url: "/user/verification",
                            data:{tmp:logotmp,type:1},
                            dataType: "json",
                            success: function (data) {}
                        });
                    },
                    error : function() {}
                });
            }
            if(v==2){
                zctmp=0;
                zcverification = false;
                $('#mpanel2').html('');
                $('#mpanel2').slideVerify({
                    type : 1,		//类型
                    vOffset : 5,	//误差量，根据需求自行调整
                    barSize : {
                        width : '100%',
                        height : '40px',
                    },
                    ready : function() {
                    },
                    success : function() {
                        verification = true;
                        var myDate = new Date();
                        var tmp = Number(myDate.getMinutes()+''+myDate.getSeconds());
                        zctmp = (tmp-500+1+2+3-4);
                        $.ajax({
                            type: "POST",
                            url: "/user/verification",
                            data:{tmp:zctmp,type:2},
                            dataType: "json",
                            success: function (data) {}
                        });
                    },
                    error : function() {}
                });
            }
        }

        function bodys() {
            var h = '<li class="nav-item"><a style="color: #f5f5f5;" target="_blank" href="/admin/goadmin" class="nav-link page-scroll d-flex flex-row align-items-center md-trigger"> <em data-feather="tool" width="18" height="18" class="mr-2"></em>控制台</a></li>';
            var h1 = '<li class="nav-item"><a style="color: #f5f5f5;" target="_blank" href="javascript:exit();" class="nav-link page-scroll d-flex flex-row align-items-center md-trigger"> <em data-feather="x-square" width="18" height="18" class="mr-2"></em>退出</a></li>';
            $("#usersrc").html(h + h1 );
            feather.replace();
        }

        function exit() {
            $.ajax({
                type: "POST",
                url: "/user/exit.do",
                dataType: "json",
                success: function (data) {
                    $.cookie('name_hellohaobycookie', null);
                    $.cookie('pass_hellohaobycookie', null);
                    layer.msg('账号已退出', {icon: 1});
                    window.location.reload();
                }
            });
        }

        function zhuce(mail, registerusername, registerpassword) {
            if(zcverification){
                //验证成功
                $.ajax({
                    type: "POST",
                    url: "/user/register",
                    data: {email: mail, username: registerusername, password: registerpassword,zctmp:zctmp},
                    dataType: "json",
                    success: function (data) {
                        if (data.ret > 0) {
                            $("#zctishi").text('注册成功');
                            if (data.zctype == 1) {
                                layer.alert('注册成功，请前往邮箱激活你的账号，注意！激活邮件如果迟迟未收到，有可能在您的【垃圾箱】中。', {
                                    skin: 'layui-layer-molv'
                                    ,closeBtn: 0
                                    ,anim: 1
                                    ,btn: ['确定']
                                    ,icon: 1
                                    ,yes:function(){
                                        window.location.reload();
                                    }
                                });
                            } else {
                                layer.alert('注册成功，快去登录体验吧。', {
                                    skin: 'layui-layer-molv'
                                    ,closeBtn: 0
                                    ,anim: 1
                                    ,btn: ['确定']
                                    ,icon: 1
                                    ,yes:function(){
                                        window.location.reload();
                                    }
                                });
                            }
                        } else {
                            if (data.ret == -2) {
                                layer.alert('注册失败，用户名或邮箱重复且用户名只能为字母数字，请重试。', {
                                    skin: 'layui-layer-molv'
                                    ,closeBtn: 0
                                    ,anim: 1
                                    ,btn: ['确定']
                                    ,icon: 2
                                });
                            } else if(data.ret == -3){
                                layer.alert('本站关闭了注册功能。', {
                                    skin: 'layui-layer-molv'
                                    ,closeBtn: 0
                                    ,anim: 1
                                    ,btn: ['确定']
                                    ,icon: 2
                                });
                            }else if(data.ret == -4){
                                layer.alert('非法注册，请刷新页面后重新尝试。', {
                                    skin: 'layui-layer-molv'
                                    ,closeBtn: 0
                                    ,anim: 1
                                    ,btn: ['确定']
                                    ,icon: 2
                                });
                            }else {
                                layer.alert('注册失败，请重试。', {
                                    skin: 'layui-layer-molv'
                                    ,closeBtn: 0
                                    ,anim: 1
                                    ,btn: ['确定']
                                    ,icon: 2
                                });
                            }
                            setTimeout(function () {
                            }, 2000);
                        }
                        again(2);
                        $("#userzc").css('display','block');
                        $("#zctishi").css('display','none');
                    }
                });
            }else{
                shakeModal(6);
                $("#userzc").css('display','block');
                $("#zctishi").css('display','none');
            }
        }

        $('.imgurltype').click(function () {
            $('.imgurltype').removeClass('layui-this');
            $(this).addClass('layui-this');
        });
        function imgurltype(v) {
            if(v==1){
                $("#imgurls").html(arr_imgurl);
            }else if(v==2){
                $("#imgurls").html(arr_markdown);
            }else if(v==3){
                $("#imgurls").html(arr_html);
            }else{
                $("#imgurls").html(arr_ddcode);
            }
        }

        function copyimgurl(t) {
            var data = $(t).children('p').text();
            var copy = new ClipboardJS('.copyimgurl', {
                text: function (trigger) {
                    return  data;
                }
            });
            copy.on('success', function (e) {
                layer.msg('复制成功');
                copy.off("success");
            });
            copy.on('error', function (e) {
                layer.msg("复制失败");
                copy.off("error");
            });
        }

        var win = null;
        function anniu(){
            if(arr_html!=null && arr_html!=""){
                win = layer.open({
                    title:'画廊分享',
                    type: 2,
                    area: ['870px', '500px'],
                    fixed: false, //不固定
                    maxmin: true,
                    content: '/addalbum'
                });
            }else{
                layer.msg('请先上传图片后再生成画廊', {icon: 7});
            }

            if($(window).width()<=880){
                layer.full(win);
            }
        }

        //浏览器窗口大小变化时
        $(window).resize(function() {
            if(win!=null){
                var window_width = $(window).width();//获取浏览器窗口宽度
                var window_height = $(window).height();//获取浏览器窗口高度
                if(window_width<880){
                    layer.full(win);
                }
            }
        });

        function Popup(url,pass) {
            layer.close(win);
            if(pass==null || pass==''){
                pass = '无'
            }
            var imgbase64 = jrQrcode.getQrBase64(url);
            var body = '<div class="layui-row">\n' +
                '<form class="layui-form" action="">\n' +
                '<div class="layui-form-item" style="width: 80%;margin: 20px auto;">\n' +
                '<div class="layui-input-block" style="margin-left: 0px;">\n' +
                '<input id="albumurl" value="'+url+'" style="color:#999;border-radius:5px;border:1px #999 solid;" readonly="readonly" type="text" name="title" lay-verify="title"  class="layui-input">\n' +
                '</div>\n' +
                '<div class="layui-form-mid "style="width:100%;text-align: center;color: #999999;font-weight: 500;">画廊密码：<span id="ckey" style="font-weight: 600;">'+pass+'</span><button onclick="copyurl()" style="margin-left: 50px;" type="button" class="copyurl layui-btn layui-btn-sm layui-btn-normal">复制链接及密码</button></div>\n' +
                '</div>\n' +
                '</form>\n' +
                '</div>\n' +
                '<div class="layui-row">\n' +
                '<div align="center"><img style="width: 150px;" src="'+imgbase64+'" /><p style="font-size: 12px;color: #999999;">将二维码分享给好友</p><p style="font-size: 12px;color: #999999;">对方通过扫码即可查看相册</p></div>\n' +
                '</div>';
            layer.open({
                type: 1,
                title:'画廊分享链接',
                area: ['520px', '400px'], //宽高
                //skin: 'layui-layer-demo', //样式类名
                closeBtn: 1, //不显示关闭按钮
                anim: 2,
                shadeClose: false, //开启遮罩关闭
                content: body
            });
        }
        function copyurl() {
            var data = "";
            var k = $('#ckey').text();
            var u = $('#albumurl').val();
            if(k=='无'){
                data = '画廊链接：'+u+ ' 复制这段内容后用浏览器打开，即可查看画廊哦';
            }else{
                data = '画廊链接：'+u+' 提取码：'+k+ ' 复制这段内容后用浏览器打开，即可查看画廊哦';
            }
            var copy = new ClipboardJS('.copyimgurl', {
                text: function (trigger) {
                    return  data;
                }
            });
            copy.on('success', function (e) {
                layer.msg('复制成功');
                copy.off("success");
            });
            copy.on('error', function (e) {
                layer.msg("复制失败");
                copy.off("error");
            });
        }
    </script>


    <script th:inline="javascript">
        var baidu = [[${config.getBaidu()}]];
        loadScriptString(baidu);
        function loadScriptString(code) {
            var script = document.createElement("script");
            script.type = "text/javascript";
            try {
                // firefox、safari、chrome和Opera
                script.appendChild(document.createTextNode(code));
            } catch (ex) {
                // IE早期的浏览器 ,需要使用script的text属性来指定javascript代码。
                script.text = code;
            }
            document.getElementsByTagName("head")[0].appendChild(script);
        }
    </script>
    </body>
</html>